<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title>Blank Page - Ace Admin</title>

		<meta name="description" content="" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

		<!-- bootstrap & fontawesome -->
		<link rel="stylesheet" href="#(CPATH)/assets/css/bootstrap.css" />
		<link rel="stylesheet" href="#(CPATH)/assets/css/font-awesome.css" />

		<!-- page specific plugin styles -->
		<link rel="stylesheet" href="#(CPATH)/assets/css/bootstrap-table.css">
		<link rel="stylesheet" href="#(CPATH)/assets/css/basejace.css">
		<link rel="stylesheet" href="#(CPATH)/assets/css/chosen.css" />
		<!-- <link rel="stylesheet" href="#(CPATH)/assets/css/bootstrap-multiselect.css" /> -->

		<!-- text fonts -->
		<link rel="stylesheet" href="#(CPATH)/assets/css/ace-fonts.css" />

		<!-- ace styles -->
		<link rel="stylesheet" href="#(CPATH)/assets/css/ace.css" class="ace-main-stylesheet" id="main-ace-style" />

		<!--[if lte IE 9]>
			<link rel="stylesheet" href="#(CPATH)/assets/css/ace-part2.css" class="ace-main-stylesheet" />
		<![endif]-->

		<!--[if lte IE 9]>
		  <link rel="stylesheet" href="#(CPATH)/assets/css/ace-ie.css" />
		<![endif]-->

		<!-- inline styles related to this page -->

		<!-- ace settings handler -->
		<script src="#(CPATH)/assets/js/ace-extra.js"></script>

		<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->

		<!--[if lte IE 8]>
		<script src="#(CPATH)/assets/js/html5shiv.js"></script>
		<script src="#(CPATH)/assets/js/respond.js"></script>
		<![endif]-->
	</head>

	<body class="no-skin">
		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>
			<form id="contentForm" action="" method="POST">
			<div class="main-content">
			<div class="page-content">
			<!-- 提示信息条 -->
			#if(message != null)
			<div class="row">
				<div class="col-xs-12">
					<div class="alert alert-info">
						<button type="button" class="close" data-dismiss="alert">
							<i class="ace-icon fa fa-times"></i>
						</button>
						#(message)
					</div>
				</div>
			</div><!-- ./提示信息条 -->
			#end
			<div class="row">
				<div class="col-sm-12 form-field">
					<div class="widget-box transparent">
						<div class="widget-header widget-header-flat">
							<h4 class="widget-title smaller">#(pagetitle ??)</h4>
	
							<div class="widget-toolbar">
								<button class="btn btn-sm btn-info" onclick="doSave()"><i class="ace-icon fa fa-floppy-o bigger-120"></i>保存</button>
								<button class="btn btn-sm" onclick="javascript:doReturn();return false;"><i class="icon-search align-top"></i>返回</button>
							</div>
						</div>
	
						<div class="widget-body">
							<div class="widget-main">
								<div class="row">
									<div class="col-xs-12 col-sm-6">
										<label class="col-xs-4">部门ID</label>
										<div class="col-xs-8">
											<input type="text" id="userdepartmentRela.departmentid" name="userdepartmentRela.departmentid" value="#(department.dptid ??)" class="col-xs-12"/>
											<!-- <div class="help-block col-xs-12 col-sm-7">这是表单验证错误信息展示形式</div> 上面input的class可以设置的更窄一点，例如col-xs-10; -->
										</div>
									</div>
									<div class="col-xs-12 col-sm-6">
										<label class="col-xs-4">部门名称</label>
										<div class="col-xs-8">
											<input type="text" id="department.dptname" name="department.dptname" value="#(department.dptname ??)" class="col-xs-12"/>
											<!-- <div class="help-block col-xs-12 col-sm-7">这是表单验证错误信息展示形式</div> 上面input的class可以设置的更窄一点，例如col-xs-10; -->
										</div>
									</div>
									<div class="col-xs-12 col-sm-6">
										<label class="col-xs-4">备注</label>
										<div class="col-xs-8">
											<textarea id="department.dptnote" name="department.dptnote"  class="col-xs-12">#(department.dptnote ??)</textarea>
										</div>
									</div>
									<div class="col-xs-12 col-sm-6">
										<label class="col-xs-4">选择员工</label>
										<div class="col-xs-8">
											<select multiple="" name="userdepartmentRela.userid" class="chosen-select col-xs-10" id="userSelect">
												#for(user : userList)
													<option value="#( user.userid ??)" #(department.userid == user.userid ? 'selected' : '')>#(user.username??)#(user.mobileno??)</option>
												#end
											</select>
										</div>
									</div>
								</div>
							</div> <!-- ./widget-main -->
							
							<div class="widget-toolbox padding-8 clearfix text-center">
								#if(ISEDIT == 'TRUE')
									<button class="btn btn-sm btn-info" onclick="doSave();return false;"><i class="ace-icon fa fa-floppy-o bigger-120"></i>保存</button>
								#end
								<button class="btn btn-sm" style="margin-left:60px;" onclick="doReturn();return false;"><i class="icon-search align-top"></i>返回</button>
							</div>
						</div>		<!-- ./widget-body -->
					</div>
				</div>
			</div>	<!-- ./outest row -->	
			
			
			</div> <!-- ./main-content -->
			</div>
			</form>	
		</div> <!-- ./main-container -->

		<!-- basic scripts -->

		<!--[if !IE]> -->
		<script type="text/javascript">
			window.jQuery || document.write("<script src='#(CPATH)/assets/js/jquery.js'>"+"<"+"/script>");
		</script>

		<!-- <![endif]-->

		<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='#(CPATH)/assets/js/jquery1x.js'>"+"<"+"/script>");
</script>
<![endif]-->
		<script type="text/javascript">
			if('ontouchstart' in document.documentElement) document.write("<script src='#(CPATH)/assets/js/jquery.mobile.custom.js'>"+"<"+"/script>");
		</script>
		<script src="#(CPATH)/assets/js/bootstrap.js"></script>

		<!-- page specific plugin scripts -->
		<script src="#(CPATH)/assets/js/bootstrap-table/bootstrap-table.js"></script>
		<script src="#(CPATH)/assets/js/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
		<script src="#(CPATH)/assets/js/chosen.jquery.js"></script>
		<script src="#(CPATH)/assets/js/jquery.validate.js"></script>
		<script src="#(CPATH)/assets/js/basejace.jquery.validate.js"></script>
		
		
		<!-- ace scripts -->
		<script src="#(CPATH)/assets/js/ace/elements.scroller.js"></script>
		<script src="#(CPATH)/assets/js/ace/elements.colorpicker.js"></script>
		<script src="#(CPATH)/assets/js/ace/elements.fileinput.js"></script>
		<script src="#(CPATH)/assets/js/ace/elements.typeahead.js"></script>
		<script src="#(CPATH)/assets/js/ace/elements.wysiwyg.js"></script>
		<script src="#(CPATH)/assets/js/ace/elements.spinner.js"></script>
		<script src="#(CPATH)/assets/js/ace/elements.treeview.js"></script>
		<script src="#(CPATH)/assets/js/ace/elements.wizard.js"></script>
		<script src="#(CPATH)/assets/js/ace/elements.aside.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.ajax-content.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.touch-drag.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.sidebar.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.sidebar-scroll-1.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.submenu-hover.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.widget-box.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.settings.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.settings-rtl.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.settings-skin.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.widget-on-reload.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.searchbox-autocomplete.js"></script>

		<!-- inline scripts related to this page -->
		<script type="text/javascript">
			cmdReturn = "#(CPATH)/system/department/showUser?dptid=#(department.dptid ??)";
			cmdSaveUserDepartmentRela = "#(CPATH)/system/department/saveUserDepartmentRela";
			
			 // 多选 select 数据初始化
	        function chose_mult_set_ini(select, values) {
	            var arr = values.split(',');
	            var length = arr.length;
	            var value = '';
	            for (i = 0; i < length; i++) {
	                value = arr[i];
	                $(select + " option[value='" + value + "']").attr('selected', 'selected');
	            }
	            //$(select).trigger("liszt:updated");
	        }
			 
			$(function(){
				//-------------- 初始化多选 下拉框
				chose_mult_set_ini('#userSelect', '#(selectUserid)'); //第二个参数是一个字符串，格式　'123,23423,123123'
				$('#userSelect').chosen({allow_single_deselect:true}); 
				//---------------
				if(parent){
					window.parent.setFrameHeight("dataFrame", $("#main-container").height()+200);
				}
			});
			
			function doSave() {
				
				$("#contentForm").validate({
					errorElement: "div",
					errorClass: "col-xs-12 col-sm-7 red",
					rules: {
						
						/* 'user.username':{
							required:true,
							minlength: 2
						},
						'user.mobileno':{
							required:true,
							regex: /^13\d{9}$/
						}
						*/
						'userdepartmentRela.userid':{
							required: true
						}
						
					}
				});
				$('#userSelect option:selected').each(function(i, domEle){
					alert($(domEle).val());
				});
				$("#contentForm").attr("action", cmdSaveUserDepartmentRela).submit();
				
			}
			function doReturn() {
				//alert( cmdReturn );
				window.location = cmdReturn;
				window.event.returnValue=false;
			}
			/*返回列表查询页面*/
			//$("#returnBtn").bind("click", doReturn);
function initContentPage(){
	//resizeMainIFrame();
	#if(ISEDIT == 'FALSE')
		disabledForm();
	#end
	scrollTop();
}
function scrollTop(){
	if(parent){
		  parent.$('html,body').animate({
               scrollTop: 0
           }, 'slow');
    }else{
    	  $('html,body').animate({
               scrollTop: 0
          }, 'slow');
    }
}

scrollTop();



		</script>
	</body>
</html>